// 监听来自popup的消息
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
  if (request.action === 'changeColor') {
    // 随机改变页面背景色
    const colors = ['#f0f0f0', '#f5f5dc', '#e6e6fa', '#f0fff0'];
    const randomColor = colors[Math.floor(Math.random() * colors.length)];
    document.body.style.backgroundColor = randomColor;
    sendResponse({ message: `背景色已改为 ${randomColor}` });
  }
});